package com.awangyh.jdk8.file;

import java.io.File;
import java.util.*;
import java.util.stream.Collectors;

/**
 * Created by admin on 2017/4/12.
 */
public class DirectoryDemo {

    public static void main(String[] args) {
        File dir=new File( "D:\\ZD_IDE\\apache-tomcat-8.5.13\\bin\\private\\netValues\\netValue" );
        if( !dir.exists() ) {
            dir.mkdirs();
        }

        List<NetValueItem> all = new ArrayList<>();
        all.add(new NetValueItem("aaa"));
        all.add(new NetValueItem("bbb"));
        all.add(new NetValueItem("ccc"));
        all.add(new NetValueItem("ffff"));
        all.add(new NetValueItem("SG95590"));
        all.add(new NetValueItem("S51952"));
        all.add(new NetValueItem("SN0186"));
        all.add(new NetValueItem("SP3301"));

        Set<String> fundCodeSet = Arrays.stream(dir.list()).collect(Collectors.toSet());
        fundCodeSet.forEach(System.out::println);
        List<NetValueItem> leftItems = all.stream().filter(it -> !fundCodeSet.contains( it.getCode()+".json" )).collect(Collectors.<NetValueItem>toList());

        leftItems.forEach(it -> System.out.println(it.getCode()));
    }
}
